{%extends "base.html"%}
{%block body%}
<div class="contingut">
<h2>Create or Edit Productor</h2>


	
<form action="{%url productes.edit_producte product.key.id%}" enctype="multipart/form-data" method="post">
	<div class="field">
		<label>Nom:</label>
		<input type="text" name="name" value="{{product.name}}">
	</div>
	<div class="field">
		<label>Imatge:</label>
		<input type="file" name="file">
		<div>
			<img src="{%url productes.getfoto product.key.id%}">
		</div>
	</div>
	<div class="field">
		<label>Descripcio:</label>
		<textarea name="descripcio" rows="3" cols="60">{{product.description}}</textarea>
	</div>
	<div class="field">
		<label>Preu:</label>
		<input name="price" type="text" value="{{product.price}}">
	</div>
	<div class="field">
		<label>Productor:</label>
		<select name="productor">
			{%for productor in productors%}
			{%if product.productor%}
			<option value="{{productor.key}}" selected="true">{{productor.name}}</option>
			{%else%}
			<option value="{{productor.key}}">{{productor.name}}</option>
			{%endif%}
			{%endfor%}
		</select>
	</div>
	<div class="field">
		<label>Actiu:</label>
		{%if product.actiu%}
		  <input type="checkbox" name="actiu" checked="true">
		{%else%}
		  <input type="checkbox" name="actiu">
		{%endif%}
	</div>
	<input type="submit" value="Create or Edit Producte">
</form>



</div>
{%endblock%}